package edu.ahut.designpattern.chainresponsibility.joke;

public class SmartGirlHandler implements GirlHandler {
    @Override
    public void handle(String loveLetter) {
        //具体的处理逻辑
        if (loveLetter.toLowerCase().contains("smart")) {
            System.out.println("I am " + name + ",I like it!");
        } else if (next != null) {
            next.handle(loveLetter);
        }
    }

    @Override
    public void setNextHandler(GirlHandler next) {
        this.next=next;
    }

    public SmartGirlHandler(String name) {
        this.name = name;
    }

    String name;
    GirlHandler next;
}
